Skip to content

Commit 5c53a49

Browse files
committed
Add mzn_max_version_required to enable models to speficy the maximum version of MiniZinc required to run the model. Fixes #872.
1 parent e97b94c commit 5c53a49

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

changes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ https://github.com/MiniZinc/libminizinc/issues.
66

77
.. _unreleased:
88

9+
Changes:
10+
^^^^^^^^
11+
- Add ``mzn_max_version_required`` to enable models to speficy the maximum
12+
version of MiniZinc required to run the model (:bugref:`872`).
13+
914
Bug fixes:
1015
^^^^^^^^^^
1116
- Fix the rewriting of the multidimensional search annotations to ensure

share/minizinc/std/stdlib/stdlib_language.mzn

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ constraint
2424
mzn_version_to_string(mzn_compiler_version()),
2525
);
2626

27+
/** @group stdlib.language If defined, this can be used to check that the MiniZinc compiler is not newer than the given version. */
28+
opt int: mzn_max_version_required;
29+
30+
constraint
31+
assert(
32+
absent(mzn_max_version_required) \/ deopt(mzn_max_version_required) >= mzn_compiler_version(),
33+
"This model only works with MiniZinc up to version " ++
34+
mzn_version_to_string(deopt(mzn_max_version_required)) ++
35+
" but you are running version " ++
36+
mzn_version_to_string(mzn_compiler_version()),
37+
);
38+
2739
/***
2840
@groupdef stdlib.options Compiler options
2941
*/

0 commit comments

Comments
 (0)